Hello!
I have typedefs like the following:
Code:
typedef std::set<std::string>TBookKey;
typedef std::vector<bookObjs>TBookValues;
typedef std::map<bookKey, bookValues> TBookMap;
And, member variable declaration:
Code:
private:
TBookMap bookMap;
** Question **
Is it possible to create an API to obtain:
The pointer or reference to the TBookKey (set), and TBookValues (vector) of the a specific pair from the bookMap? (Not a copy of them)
I think, if I define the API signature such as:
Code:
// iterate through BookMap to get the actual Key/Value reference of specified pair.
void
GetBookMapPair(const int bookID, TBookKey& key, TBookValues& value);
The caller will always get a copy of TBookKey and TBookValues of the specified (bookID) pair, but not the pointer/reference of the Key/Value. Because that the operator= of set/vector is overloaded to make a copy. Is it correct? Any suggestions/comments?
may tks!